home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
BBS
/
MUBBS
/
MUBBS etc.cpt
/
Module Source
/
E-mail
/
CheckForEmail.c
< prev
next >
Wrap
Text File
|
1991-11-21
|
8KB
|
269 lines
/* *********************************************************************************
MODULE: CheckForEmail Module
DESCRIPTION: This CheckForEmail Module is a simple module for MUBBS, the
Multi-User Bulliten Board System Software.
AUTHOR: Noam Freedman
Copyright © 1990 by Noam Freedman. Portions are also Copyright Symantec Corp.
This program source code and it's compiled version IS NOT IN THE
PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NMF" file for details
regarding use of this program source code and it's compiled version.
Revision History:
============================================================
10/20/91 - Started programming
11/ 4/91 - Edited for release
============================================================
******************************************************************************** */
#define INMAIN
#include "MUBBS Module.h"
#include "Email.h"
#include <SetUpA4.h>
/* my globals for this module */
pascal void main (mode1,G1,P1) /* called from the main routines, and what mode to be in */
int mode1;
struct GS *G1; /* we point to the "global" struct in the Main Module here */
Ptr P1; /* we ignore this pointer, we do not use it at all */
{
Handle temph;
float version = 0.5; /* what version of MUBBS you are compatable with IE: .5 and above */
RememberA0(); SetUpA4(); /* This sets up the A4 register to access our globals */
asm { _RecoverHandle }; asm {move.l a0,temph}; HLock(temph); /* locks our module, do this ! */
G=G1; /* This MUST be the first thing you do in main only, it sets up the struct globals */
mode[u]=mode1; /* set up our mode so that you can read it anywhere */
switch (mode[u]) { /* any un-handled modes return error from this module */
case 2:
dostuff();
G->moduleresult=0;
break;
case 98:
versionck(version); /* just return after this call, don't modify anything */
break;
case 0:
strcpy (G->programmer,"Noam Freedman"); /* show the programmer's name up to 20 chars*/
G->moduleresult=0; /* this was also a init call if we need close call put 99 here */
break;
default:
G->moduleresult=1; /* return bad code */
};
HUnlock(temph); /* unlocks this module, do this ! */
RestoreA4(); /* call this when you are all done */
}
dostuff()
{
char pad[100]; /* this is a fix for a problem */
FILE *fp_headers;
int choice, i, num, r, deleteflag;
char tempstring[10], ch;
char pad2[100]; /* this is a fix for a problem */
struct LoadStruct S;
struct MsgStruct MsgInfo;
struct EnterStruct E;
if (!G->online[u]) { num = 2;goto byebye; } /* do this check so we can log out if hang up */
loguser("In E-Mail Module"); /* this tells where you are for remote sysop, or writes to log file */
/* you print the following so that the sysop can monitor use on the mac screen */
print("C> Line %d %s, at: E-Mail\n",(u+1),G->username[u]);
while (TRUE)
{
if(!cmd1("]] *** E-Mail Menu ***]]>> Read, Send, Help, Quit : ")) goto byebye;
send(G->CR[u]);
ch = G->input[u];
switch(ch)
{
case 'H':
send("]E-Mail Menu:");
send("]");
send("] This the main E-Mail menu, you select if you want to read");
send("]or send some mail to another person. To delete a message, read it first:");
send("]");
send("]R)ead - Checks for any existing mail and allows you to read it.");
send("]");
send("]S)end - Allows you to send mail to another user.");
send("]");
send("]H)elp - Displays this file.");
send("]");
send("]Q)uit - Leaves E-Mail.");
send("]");
break;
case 'R':
goto CheckEmail;
break;
case 'S':
goto SendEmail;
break;
case 'Q':
goto byebye;
break;
}
continue; /* back to start of while */
CheckEmail:
module (3,"check_email",&S);
if (S.result == 20)
{
send("]You have %i or more pieces of mail. To view MORE you must delete some.]",MAXEMAIL);
}
if (S.result == 21)
{
send("]You have no mail at this time.]");
continue;
}
if (S.result != 0) continue;
AskQuestion: /* this is default (S.result = 0) */
r = 0;
send("]You have mail from:]]");
for ( i=1 ; i<=S.numemail ; i++)
{
send("%i) %s %s]",i,S.FromUser[i],S.title[i]);
}
send("]>> # to read, (return=first), Quit : ");
portsin(tempstring, 2);
send(G->CR[u]);
if (! G->online[u]) goto byebye;
if (tempstring[0] == 'Q') continue; /* go back to main menu */
if (tempstring[0] == 'q') continue;
S.choice=strtoint(tempstring,"%i",&S.choice);
if ( S.choice == 0) S.choice=1;
if ( S.choice > S.numemail ) {
send("]Invalid choice, please try again.]]");
goto AskQuestion;
}
send(G->CR[u]);
DisplayMessage:
module(3,"display_email",&S);
send ("]-END-");
if (S.choice == 1) send (" (Please delete your mail when you are done with it)]");
else send(G->CR[u]);
back:
if(!cmd1("]>> Email sender, Delete, Re-read, + (return), -, Help, Quit : ")) goto byebye;
send(G->CR[u]);
ch = G->input[u];
switch(ch)
{
case 'H':
send("]E-Mail Prompt:");
send("]");
send("] The E-mail prompt is shown after a e-mail message has been");
send("]shown. There are 8 option to choose from:");
send("]");
send("]E)mail sender - Begins an e-mail message addressed to the");
send("] person who sent you the last message you read.");
send("]");
send("]D)elete - Deletes the current e-mail message.");
send("]");
send("]R)e-read - Displays the last e-mail message again.");
send("]");
send("]+ - Advances to the next e-mail message (or hit RETURN).");
send("]");
send("]- - Retreats to the previous e-mail message.");
send("]");
send("]H)elp - Displays this file.");
send("]");
send("]Q)uit - Returns to E-Mail Main Menu.");
send("]");
break;
case 'R':
goto DisplayMessage;
break;
case 'E':
if (!cmd1("]Delete this message first (Y/N) (return=YES) ? ") ) return;
send(G->CR[u]);
deleteflag=FALSE;
if (G->input[u] != 'N')
{
module(3,"delete_email",&S); /* delete it */
deleteflag=TRUE;
}
strcpy(E.ToUser,S.FromUser[S.choice]); /* set this to the sender's name */
module(3,"enter_email",&E); /* call the enter module */
if (E.result ==10) module(3,"save_email",&E); /* call the save module */
if (deleteflag) {
module (3,"check_email",&S); /* do the check again */
if (S.result == 21) continue; /* no more mail */
if (S.result != 0) continue; /* or fall through to + */
}
goto fall;
break;
case 'Q':
continue;
case '-':
if (S.choice <= 1)
S.choice = S.numemail;
else
S.choice = S.choice - 1;
goto DisplayMessage;
break;
case 'D':
module(3,"delete_email",&S); /* delete it */
module (3,"check_email",&S); /* do the check again */
if (S.result == 21) continue; /* no more mail */
if (S.result != 0) continue; /* or fall through to + */
case '+':
case '\r':
fall:
if (S.choice >= S.numemail)
S.choice = 1;
else
S.choice = S.choice + 1;
goto DisplayMessage;
break;
}
goto back;
SendEmail:
strcpy(E.ToUser,""); /* set this to blank so it asks for a user's name */
module(3,"enter_email",&E); /* call the enter module */
if (E.result == 10) module(3,"save_email",&E); /* call the save module */
} /* closes "main menu" while loop */
byebye:
return;
}